/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.time.LocalDate;

/**
 * <p>Project: javase202202 - Switch5
 * <p>Powered by Lisi On 2022-06-01 10:23:15
 * <p>Created by IntelliJ IDEA
 *

 * @version 1.0
 * @since 17
 */
public class Switch6 {
    public static void main(String[] args) {
        int y = 2022;
         int m = 3;
        int days = switch (m) {
            case 2 -> {

                //LocalDate
                yield LocalDate.of(y, m,1).isLeapYear() ? 29 : 28;
            }
            case 4, 6, 9, 11 -> 30;
            default -> 31;
        };
        System.out.printf("%d年%d月有%d天", y, m, days);

    }
}
